package comday08.itheima01;

import java.util.Scanner;

public class Demo09 {
    public static void main(String[] args) {
        //键盘录入一个字符串，统计该字符串中大写字母字符，小写字母字符，数字字符出现的次数
        //(不考虑其他字符)


        //1.键盘输入一个字符串
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个字符串：");
        String s = sc.next();

        //2.定义统计个数的变量
        int count1 = 0;
        int count2 = 0;
        int count3 = 0;

        //3.遍历字符串
        for(int i=0; i<s.length();i++){
            //4.获取每个字符
            char ch = s.charAt(i);
            //5.判断字符是否符合要求
            if(ch>='A' && ch<='Z'){
                count1++;
            }else if(ch>='a' && ch<='z'){
                count2++;
            }else if(ch>='0' && ch<='9'){
                count3++;
            }
        }
        //6.打印结果
        System.out.println("大写字母有：" + count1 + "个");
        System.out.println("小写字母有：" + count2 + "个");
        System.out.println("数字字符有：" + count3 + "个");
    }
}
